a,b,c=input('input:').split(',')
i=0;ax=ord(a[i]);bx=ord(b[i]);cx=ord(c[i])
while ax<bx:
    break
else:
     if ax>bx:
        d=a;a=b;b=d
     if ax==bx:
        i=i+1
     ax=ord(a[i]);bx=ord(b[i])
i=0;ax=ord(a[i]);bx=ord(b[i])

while bx<cx:
    break
else:
     if bx>cx:
        d=b;b=c;c=d
     if bx==cx:
        i=i+1
     bx=ord(b[i]);cx=ord(c[i])
i=0;bx=ord(b[i])

while ax<bx:
    break
else:
     if ax>bx:
        d=a;a=b;b=d
     if ax==bx:
        i=i+1
     ax=ord(a[i]);bx=ord(b[i])
print(a,',',b,',',c)
